<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <title>心理测验系统</title>
        <link rel="stylesheet" href="/css/admin.css" media="all">
        <link rel="stylesheet" href="/layui/css/layui.css" media="all">

    </head>
    <body class="layui-layout-body">
        <div class="layui-layout layui-layout-admin">
            <div class="layui-header">
                <div class="layui-logo">测验系统 后台</div>
                <ul class="layui-nav layui-layout-right">
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                            admin
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="/admin/views/password" target="iframe">修改密码</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item"><a href="/admin/logout">退了</a></li>
                </ul>
            </div>

            <div class="layui-side layui-bg-black">
                <div class="layui-side-scroll">
                    <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                    <ul class="layui-nav layui-nav-tree" lay-filter="select">
                        <li class="layui-nav-item layui-nav-itemed">
                            <a class="" href="javascript:;">用户管理</a>
                            <dl class="layui-nav-child">
                                <dd class="layui-this"><a href="/admin/views/userManagement" target="iframe">用户</a></dd>
                                <dd><a href="/admin/views/userAdd" target="iframe">用户上传</a></dd>
                            </dl>
                        </li>
                        <li class="layui-nav-item">
                            <a href="javascript:;">题库管理</a>
                            <dl class="layui-nav-child">
                                <dd><a href="/admin/views/quesManagement" target="iframe">题库</a></dd>
                                <dd><a href="/admin/views/quesAdd" target="iframe">试题上传</a></dd>
                            </dl>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="layui-body">
                <div class="layadmin-tabsbody-item layui-show">
                    <iframe src="/admin/views/userManagement" frameborder="0" class="layadmin-iframe" name="iframe"></iframe>
                </div>
            </div>

            <div class="layui-footer">
                <!-- 底部固定区域 -->
                fjutsl.top
            </div>
        </div>
        <script src="/layui/layui.js"></script>
        <script>

            layui.use(['layer','element'], function(){
                const $ = layui.$;
                const element = layui.element;
                const iframe = $(".layui-body .layui-show")[0];

                element.on('nav-item', function(data){
                    const a_href = $(data[0]).prop('href');
                    if (a_href === "javascript:;") return;
                    // 插入 iframe
                    let str = `<iframe src=${a_href} frameborder="0" class="layadmin-iframe" name="iframe"></iframe>`;
                    iframe.innerHTML = str;
                });
            });
        </script>
    </body>
</html>